const fetch = require('node-fetch');

async function httpGet(url) {
  const data = await fetch(url);
  const json = await data.json();
  return json;
}

async function httpPost(url, body) {
  const data = await fetch(url, {
    method: 'post',
    body: JSON.stringify(body),
    headers: {
      'Content-Type': 'application/json'
    }
  });
  const json = await data.json();
  return json;
}

module.exports = {
  httpGet,
  httpPost
};
